package com.ptszyxx.popose.module.base.user;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProviders;

import com.ptszyxx.popose.BR;
import com.ptszyxx.popose.R;
import com.ptszyxx.popose.databinding.ActivityUserWechatBinding;
import com.ptszyxx.popose.module.base.user.vm.UserWechatVM;
import com.ysg.base.BaseFragment;
import com.ysg.http.data.AppViewModelFactory;
import com.ysg.utils.YImageUtil;
import com.ysg.utils.YSPUtils;
import com.ysg.utils.YStringUtil;

/**
 * 完善用户信息
 */
public class UserWechatFragment extends BaseFragment<ActivityUserWechatBinding, UserWechatVM> {

    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.activity_user_wechat;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public UserWechatVM initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getActivity().getApplication());
        return ViewModelProviders.of(this, factory).get(UserWechatVM.class);
    }

    @Override
    public void initView() {
        super.initView();
        if (YStringUtil.isNotEmpty(YSPUtils.getInstance().getUserPic())){
            YImageUtil.show(binding.ivAvatar, YSPUtils.getInstance().getUserPic());
        }
    }
}